<script type="text/javascript" src="http://res.wx.qq.com/open/js/jweixin-1.2.0.js"></script>
<style>
    .QRcode{width: 100%;}
    .footer-home{display: none;}
    #share_mask{background-color:rgba(0,0,0,0.88);position:fixed;top:0;left:0;z-index:999}
    #share_mask img{width:100%;}
    img{cursor: pointer;}
    a{cursor: pointer;}
    .confirm{cursor: pointer;}
    .btn{margin:0;border:0;}
    .ok{text-align: center;margin-top: 1%;color:#000000;}
    .link{text-align:center;font-size: 1.3rem;}
    .link a{color: #044a85;text-decoration:underline}
    footer p{height: 4rem;line-height: 1.5rem !important;}
    .toggle,.bordertop{
        display:inline-block; width:100%;
        font-size:1.2rem; color:#000;
        text-decoration:none;
        text-align:center; height:4rem;
        line-height:4rem;
        border-top:.01rem solid #c7ae89; padding-top:3%;
    }
    .section .nickname{
        overflow: hidden;
        text-overflow:ellipsis;
        white-space: nowrap;
    }

</style>
<div class="header-msg">
    &nbsp;&nbsp;
    <span class="prompt"><?php echo $output['bargain_info']['bg_rs'];?></span>
    <span>人参与</span>&nbsp;&nbsp;&nbsp;
    <span class="prompt"><?php  echo  $output['bargain_info']['share_sun'];?></span>
    <span>次分享</span>
</div>

<img class="header-img" src="resource/images/peng.jpg" />

<div class="countdown">
    距活动结束：<span class="day" id="day"></span>天
    <span class="hour" id="hour"></span>时
    <span class="Minute" id="Minute"></span>分
    <span class="second" id="second"></span>秒
</div>


<div id="bgpg" >

  <div class="content">
        <img class="banner" src="<?php echo getbargain_img($output['bargain_info']['bg_face']); ?>" />
        <div class="price">
         <div class="Fl">
        <span class="minimumprice">
          最低价 <span class="prompt">￥<?php echo $output['bargain_info']['bg_floorprice']; ?></span>
          </span>
            <span class="originalprice">原价￥<?php echo $output['bargain_info']['bg_price'];?></span>
            </div>
            <div class="Fr">
            <div class="participate">
                <span class="prompt"><?php echo $output['bargain_info']['bg_true_rs'];?></span>人已成功<?php if($output['bargain_info']['is_hot'] ==1){?>，总共<span class="prompt"><?php echo $output['bargain_info']['bg_store']; ?></span>份<?php }?>
            </div>
            </div>
        </div>
        <p><?php echo $output['bargain_info']['bg_title']; ?></p>
    </div>

    <img src="resource/images/img-15.png" width="100%"/>

    <div class="content" style="margin-top: -7px;">
        <div class="Progressbar">
            <div class="Presentprice"style="width:100%; "></div>
            <div class="span">
                现价：<span style="color:#ffffff;">￥<?php echo isset($output['order_info']['bg_order_price'])? $output['order_info']['bg_order_price']:$output['bargain_info']['bg_price']; ?></span>
            </div>
        </div>
        <p class="brown">已获得<?php echo isset($output['number'])? $output['number']:0; ?>人帮助，共计<?php  echo sprintf("%.2f",$output['order_info']['bg_price']-$output['order_info']['bg_order_price']); ?>元。</p>
    </div>
<?php ?>
    <!-- 未参加活动的用户显示的内容-->
   <?php if($output['status']=='null'){ ?>
    <div class="personal-I" style="">
        <img class="h-portrait" src="<?php echo $output['member']['headimgurl'] ?>" />
        <div class="nick-n"><?php echo $output['member']['nickname']; ?></div>
    </div>
   <div class="function" style="">
        <a  class="takepartin" onclick="joinactivity();">
            <img src="resource/images/img-18-1.png" />
        </a>
    </div>
<?php  }?>


   <!--  参加该活动的用户显示的内容 -->
<?php  if($output['status']=='myorder'  ){ ?>

    <?php if($output['order_info']['bg_order_status']=='10' || $output['order_info']['bg_order_status']=='30') {?>
    <div class="function" style="display: ">
        <img src="resource/images/img-18-3.png"  class="aImg"  style="height: 50%; width: 48%;" id="seek_help"/>
        <img src="resource/images/img-18-4.png" class="aImg" style="height: 50%; width: 48%; float:right" id="submit_order"/>
    </div>
<?php } else{ ?>
        <div class="function" style="">
           <a  class="takepartin"  style="margin-top: 30px;">
                <img src="resource/images/order_ok.png" />
            </a>
        </div>
<?php } ?>
<?php  }?>

    <?php  if($output['status']=='helporder' || $output['status'] == 'myorder'){?>
        <?php  if($output['status']=='helporder'){?>
       <?php  if($output['order_info']['bg_order_status']=='10' || $output['order_info']['bg_order_status']=='30') {?>
    <!--帮忙砍价显示的内容 -->
    <div class="function" style="display: ">
       <img src="resource/images/img-13-16.png"  class="aImg" id="help_kanjia" style="height: 50%; width: 48%;" href="" />
       <img src="resource/images/img-13-14.png" class="aImg" style="height: 50%; width: 48%; float:right" id="friend_pay" />
      <img src="resource/images/img-13-5_03.png"  class="aImg" onclick="joinactivity();" style="height: 100%; width:30%; margin-left:35%;"  href="http://www.baidu.com">
        </div>
        <?php   }else{?>

                <div class="function" style="">
                    <img src="resource/images/img-13-5_03.png"  class="aImg" onclick="joinactivity();" style="height: 100%; width:30%; margin-left:35%;"  href="http://www.baidu.com">
                </div>
                <div class="ok">该好友参与活动已完成，人品爆棚，商品已砍到底价!</div
        <?php }?>

<?php  } ?>
<?php  if($output['order_info']['bg_order_status']=='10' || $output['order_info']['bg_order_status']=='30') { ?>
    <div class="section" style="display:">

        <img class="title" src="resource/images/image-22.png" />
        <div class="list selectmodel" >
            <span>帮砍榜</span>
        </div>
        <div class="verticalline"></div>
        <div class="list" >
            <span>代付榜</span>
        </div>

<?php if(!empty($output['count_civil'])){?>
<!-- 砍价榜 -->
        <div id="help">
            <?php  foreach($output['count_civil'] as $k =>$v ){  ?>
            <div class="individual">
                <div class="Headportrait">
                    <img class="Headportrait" src="<?php echo $v['headimgurl']; ?>"/>
                </div>
                <div class="nickname"><?php echo $v['nickname']; ?></div>
                <div class="cash"><?php echo $v['cuont_sunm'];?></div>
                <!--<img class="ranking" src="resource/images/img-5.png"/>-->
                <img class="ranking" src="resource/images/<?php
                        switch($k){
                            case '0':
                                echo "img-5.png";
                                break;
                            case '1':
                                echo "img-16.png";
                                break;

                            case '2':
                                echo "img-17.png";
                                break;
                            case '3':
                                echo "img-18.png";
                                break;

                        }
                 ?>"/>
            </div>
            <?php  } ?>

        </div>
<?php  }?>
  <?php  if(!empty($output['paid_civil'])){  ?>

        <div id="pay" style=" display:none">
            <?php foreach($output['paid_civil'] as $k =>$v){ ?>
                <?php if(!empty($v['paid_sunm'])){ ?>
            <div class="individual">
                <div class="Headportrait">
                    <img class="Headportrait" src="<?php echo $v['headimgurl'];?>" />
                </div>
                <div class="nickname"><?php echo $v['nickname']; ?></div>
                <div class="cash"><?php echo $v['paid_sunm'];?></div>
                <img class="ranking" src="resource/images/<?php
                switch($k){
                    case '0':
                        echo "img-5.png";
                        break;
                    case '1':
                        echo "img-16.png";
                        break;

                    case '2':
                        echo "img-17.png";
                        break;
                    case '3':
                        echo "img-18.png";
                        break;

                }
                ?>" />
            </div>
                <?php  }?>
           <?php  } ?>

        </div>
        <?php } ?>
        <a class="bordertop" href="index.php?act=bargain_order&op=ranking_list&order_id=<?php echo isset($_GET['order_id'])?$_GET['order_id']:$output['order_info']['bg_order_id']; ?>">查看更多</a>
    </div>
<?php } ?>
<?php  }?>

    <!-- 商品详细信息-->
    <div class="section" id="wrap">
        <img class="title" src="resource/images/image-25.png" />
        <div id="wrap1">
            <?php  echo  $output['bargain_info']['bg_detail'];?>
        </div>
    </div>


    <!-- 活动规则-->
    <div class="section">
        <img class="title" src="resource/images/image-24.png" />
        <?php  echo  $output['bargain_info']['bg_rule'];?>
    </div>
    <!-- 公司信息 -->
    <div class="section">
        <img class="title" src="resource/images/img-13-4.png" />
        <?php echo $output['bargain_info']['firm_info']; ?>
    </div>

    <footer>
        <a href="index.php?act=bargain&op=index&type=2" ><img src="resource/images/img-13-12.png" class="aImg" style="width:26%; height:30%; margin-left:4%" /></a>
        <a href="index.php?act=bargain&op=index&type=1"><img src="resource/images/img-13-13.png" class="aImg" style="width:26%; height:30%; margin-left:6%;"/></a>
        <a href="index.php?act=bargain_pk"><img src="resource/images/img-13-10.png" class="aImg" style="width:26%; height:30%; margin-left:6%"/></a>
        <div class="link"><a href="<?php echo $output['link_info']['link_url'] ;?>"><?php echo $output['link_info']['link_title'] ;?></a></div>
        <p>@互程&nbsp;本次活动最终解释权归互程所有</p>
    </footer>
</div>
<!--弹窗-->
<div id="Transparent"  class = "Transparent" style="display: none;">

    <div id="Popup" >

    </div>

</div>
<!--订单提交弹窗 -->
<div id="placeOrder" style="display: none;">
    <div id="Popup" class="Popup">
        <h2>提交订单</h2>
        <p>您确定以<span><?php echo isset($output['order_info']['bg_order_price'])? $output['order_info']['bg_order_price']:$output['bargain_info']['bg_price']; ?></span>元提交订单吗？</p>
       <?php  if($output['bargain_info']['type']==1){ ?>
        <p class='sm'>提交后，请按提示到门店购领</p>
       <?php }?>
        <div class='btn' style="margin:0;border:0;">
            <a class='confirm' id="no"> 取消</a>
            <a class='confirm' id="yes"> 确定</a>
        </div>
    </div>
</div>
<script>
    /* 微信分享 */
      wx.config({
        debug: false, // 开启调试模式,调用的所有api的返回值会在客户端alert出来，若要查看传入的参数，可以在pc端打开，参数信息会通过log打出，仅在pc端时才会打印。
        appId: '<?php     echo $output['signPackage']['appId']; ?>', // 必填，公众号的唯一标识
        timestamp: <?php  echo $output['signPackage']['timestamp']; ?>, // 必填，生成签名的时间戳
        nonceStr: '<?php  echo $output['signPackage']['nonceStr']; ?>', // 必填，生成签名的随机串
        signature: '<?php echo $output['signPackage']['signature']?>',// 必填，签名，见附录1
        jsApiList: ['onMenuShareTimeline','onMenuShareAppMessage'] // 必填，需要使用的JS接口列表，所有JS接口列表见附录2
    });

    wx.ready(function(){
        //分享至朋友圈
        wx.onMenuShareTimeline({
            <?php if($output['status']=='myorder') {?>
            title: '<?php echo $output['member']['nickname'].'正在参加'.$output['bargain_info']['bg_title'].'快来帮助我吧！'; ?>', // 分享标题
            link: '<?php echo 'http://'.$_SERVER['HTTP_HOST'].$_SERVER['REQUEST_URI'].'&order_id='.$output['order_info']['bg_order_id']; ?>', // 分享链接，该链接域名或路径必须与当前页面对应的公众号JS安全域名一致
            <?php }elseif($output['status']=='helporder'){ ?>
            title: '<?php echo $output['member']['nickname'].'邀请您帮助'.$output['bargain_info']['bg_title'].'快来帮助我吧！'; ?>', // 分享标题
            link: '<?php echo 'http://'.$_SERVER['HTTP_HOST'].$_SERVER['REQUEST_URI']; ?>',
            <?php }else{?>
            title: '<?php echo $output['bargain_info']['bg_title'].'快来参加吧！'; ?>', // 分享标题
            link: '<?php echo 'http://'.$_SERVER['HTTP_HOST'].$_SERVER['REQUEST_URI']; ?>',
            <?php }      ?>
            imgUrl: '<?php echo getbargain_img($output['bargain_info']['bg_thumb']); ?>', // 分享图标
            success: function () {
                // 用户确认分享后执行的回调函数,增加分享次数
                $.get('index.php?act=bargain&op=add_share',{bargain_id:bargain_id},function(e){},'json')



            },
            cancel: function () {
                // 用户取消分享后执行的回调函数

            }
        });

        //分享给朋友
        wx.onMenuShareAppMessage({
            <?php if($output['status']=='myorder') {?>
            title: '<?php echo $output['member']['nickname'].'正在参加'.$output['bargain_info']['bg_title'].'快来帮助我吧！'; ?>', // 分享标题
            //link: '<?php echo 'http://'.$_SERVER['HTTP_HOST'].$_SERVER['REQUEST_URI'].'&order_id='.$output['order_info']['bg_order_id']; ?>', // 分享链接，该链接域名或路径必须与当前页面对应的公众号JS安全域名一致
            link:'<?php echo 'http://'.$_SERVER['HTTP_HOST'].'/index.php?'.'&act='.$output['get']['act'].'&op='.$output['get']['op'].'&bargain_id='.$output['get']['bargain_id'].'&order_id='.$output['order_info']['bg_order_id']; ?>',
            <?php }elseif($output['status']=='helporder'){ ?>
            title: '<?php echo $output['member']['nickname'].'邀请您帮助'.$output['bargain_info']['bg_title'].'快来帮助我吧！'; ?>', // 分享标题
            //link: '<?php echo 'http://'.$_SERVER['HTTP_HOST'].$_SERVER['REQUEST_URI']; ?>',
            link:'<?php echo 'http://'.$_SERVER['HTTP_HOST'].'/index.php?'.'&act='.$output['get']['act'].'&op='.$output['get']['op'].'&bargain_id='.$output['get']['bargain_id'].'&order_id='.$output['order_info']['bg_order_id']; ?>',
            <?php }else{?>
            title: '<?php echo $output['bargain_info']['bg_title'].'快来参加吧！'; ?>', // 分享标题
            //link: '<?php echo 'http://'.$_SERVER['HTTP_HOST'].$_SERVER['REQUEST_URI']; ?>',
            link:'<?php echo 'http://'.$_SERVER['HTTP_HOST'].'/index.php?'.'&act='.$output['get']['act'].'&op='.$output['get']['op'].'&bargain_id='.$output['get']['bargain_id'].'&order_id='.$output['order_info']['bg_order_id']; ?>',
            <?php }      ?>
            desc: '友帮拼人品，见证奇（友）迹（情）的时刻到了！', // 分享描述
            imgUrl: '<?php echo getbargain_img($output['bargain_info']['bg_thumb']); ?>', // 分享图标
            type: '', // 分享类型,music、video或link，不填默认为link
            dataUrl: '', // 如果type是music或video，则要提供数据链接，默认为空
            success: function () {
                // 用户确认分享后执行的回调函数
                $.get('index.php?act=bargain&op=add_share',{bargain_id:bargain_id},function(e){},'json')
            },
            cancel: function () {
                // 用户取消分享后执行的回调函数
            }
        });
    });




    /* 活动倒计时时间*/

    function GetRTime(){

        var EndTime= new Date('<?php echo date('Y/m/d H:i:s',$output['bargain_info']['end_time']);?> ');
        var NowTime = new Date();
        var t =EndTime.getTime() - NowTime.getTime();
        var d=0;
        var h=0;
        var m=0;
        var s=0;
        if(t>=0){
            d=Math.floor(t/1000/60/60/24);
            h=Math.floor(t/1000/60/60%24);
            m=Math.floor(t/1000/60%60);
            s=Math.floor(t/1000%60);
        }


        document.getElementById("day").innerHTML = d ;
        document.getElementById("hour").innerHTML = h ;
        document.getElementById("Minute").innerHTML = m ;
        document.getElementById("second").innerHTML = s ;

    }

    setInterval("GetRTime()",0);
    var bargain_id = "<?php  echo $output['bargain_info']['bargain_id']; ?>";
    var member_id = "<?php echo  $output['member']['member_id']; ?>";
    <?php  if(!empty($_GET['order_id'])){?>

    var order_id = <?php echo $_GET['order_id']; ?>;

    <?php  }?>



//点击砍价
    var kanjia = false;
    $("#help_kanjia").click(function(){

         if(order_id==''){
             popAlert('非法提交');
             return false;
         }
        if(kanjia){
            return false;
        }
        kanjia = true;
        $.ajax({
            type:'post',
            data:{bargain_id:bargain_id,member_id:member_id,order_id:order_id},
            url:'index.php?act=bargain&op=help_bargain',
            dataType:'json',
            success:function(result){
               if(!result.datas.error){
                   $("#Transparent").show();
                   var neirong = " <img class='close' src='resource/images/img-17-5.png' /> <p>您成功砍价<span>"+result.datas+"</span>元</p><a class='confirm' ><img src='resource/images/img-17-4.png' />OK</a>";
                   $("#Popup").append(neirong);
                   $(document).on('click','#Popup>.close,#Popup>.confirm',function(){
                       $("#Popup").empty();
                       $("#Transparent").hide();
                       kanjia = false;
                       if(result.datas>0){
                           window.location.href = location.href+'&time='+((new Date()).getTime());
                       }
                 })
               }else {
                   if(result.datas.error.code =='-200'){
                       $("#Transparent").show();
                       var neirong = "<img class='close' src='resource/images/img-17-5.png' /><p></p><p>"+result.datas.error.msg+"</p><a class='confirm' ><img src='resource/images/img-17-4.png' />OK</a>";
                       $("#Popup").append(neirong);
                       $(document).on('click','#Popup>.close,#Popup>.confirm',function(){
                           kanjia = false;
                           $("#Popup").empty();
                           $("#Transparent").hide();
                       });
                   }else {

                       $("#Transparent").show();
                       var neirong = " <img class='close close_1'  src='resource/images/img-17-5.png' /><p>亲，再接再励！</p><p>可以帮我买单么么哒！</p><a  class='confirm confirm_1' > <img src='resource/images/img-17-4.png' />OK</a>";
                       $("#Popup").append(neirong);
                       $(document).on('click','#Popup>.close_1,#Popup>.confirm_1',function(){
                           kanjia = false;
                           $("#Popup").empty();
                           $("#Transparent").hide();
                           $("#friend_pay").trigger("click");

                       })

                   }


               }
            }
        })

    });



//用户点击参加活动
function joinactivity(){

    $.ajax({
        type:'post',
        data:{bargain_id:bargain_id,member_id:member_id},
        url:'index.php?act=bargain&op=joinactivity',
        dataType:'json',
        success:function(result){
            //alert(result.datas);
            if(!result.datas.error){

                $("#Transparent").show();
                var neirong = " <img class='close' src='resource/images/img-17-5.png' /><p>您报名成功</p><p>自己砍了<span >"+result.datas+"</span>元</p><a  class='confirm'><img src='resource/images/img-17-4.png' />OK</a>";
                $("#Popup").append(neirong);
                $(document).on('click','#Popup>.close,#Popup>.confirm',function(){
                    $("#Popup").empty();
                    window.location.href='index.php?act=bargain&op=bargain_info&bargain_id='+bargain_id;
                    $("#Transparent").hide();
                })
            }else {

                if(result.datas.error.code =='300'){
                    //表示未关注公众号
                    var neirong = "<img class='close' src='resource/images/img-17-5.png' /><p>您还未关注公众号</p><p>请先关注下方二维码噢！</p><img class='QRcode' src='<?php echo getbargain_img($output['bargain_info']['code_img']); ?>' />";
                    pop(neirong,1);

                }else if(result.datas.error.code =='400') {
                    var neirong = " <img class='close' src='resource/images/img-17-5.png' /><p></p><p>"+result.datas.error.msg+"</p><a  class='confirm' ><img src='resource/images/img-17-4.png' />OK</a>";
                    pop(neirong,2);

                }else{
                    var neirong = " <img class='close' src='resource/images/img-17-5.png' /><p></p><p>"+result.datas.error.msg+"</p><a  class='confirm' ><img src='resource/images/img-17-4.png' />OK</a>";
                    pop(neirong,0);
                }
            }
        }

    })
}

    //朋友点击代付 验证是否可以代付
   $("#friend_pay").click(function(){

        var order_id = "<?php echo isset($output['order_info']['bg_order_id'])? $output['order_info']['bg_order_id']:$_GET['order_id']; ?>";
        $.ajax({
            type:'post',
            data:{bargain_id:bargain_id,order_id:order_id},
            url:'index.php?act=bargain_order&op=check_pay',
            dataType:'json',
            success:function(result){
             if(result.datas.error){
                 var neirong = " <img class='close' src='resource/images/img-17-5.png' /><p></p><p>"+result.datas.error+"</p><a class='confirm' ><img src='resource/images/img-17-4.png' />OK</a>";
                 pop(neirong,1);
             }else{
                 //跳转到代付页面
                 window.location.href="index.php?act=bargain_order&op=friend_pay&bargain_id=<?php echo $output['bargain_info']['bargain_id']; ?>&order_id="+order_id;
             }
         }

        })

    })
    //找朋友砍价
   $("#seek_help").click(function(){
        var is_weixin = '<?php echo $output['is_weixin'] ?>' ;
        if(is_weixin ==''){
            var obj = {
                appshareurl:'<?php echo 'http://'.$_SERVER['HTTP_HOST'].$_SERVER['REQUEST_URI'].'&order_id='.$output['order_info']['bg_order_id']; ?>',//分享链接
                title:'<?php echo $output['member']['nickname'].'正在参加'.$output['bargain_info']['bg_title'].'快来帮助我吧！'; ?>', // 分享标题
                imgurl:'<?php echo getbargain_img($output['bargain_info']['bg_thumb']); ?>', // 分享图标
                desc: '友帮拼人品，见证奇（友）迹（情）的时刻到了！', // 分享描述
            }
            //不在微信里面，返回分享参数给app
            try{
                 window.app.AppShare(JSON.stringify(obj));

            }catch(e){

            }
            try{
                window.webkit.messageHandlers.AppShare.postMessage(JSON.stringify(obj));
            }catch (e){

            }






        }else{
            var imgurl='resource/images/attention.gif';
            $("body").append(
                "<div id='share_mask' onclick='hiddenSetting()' style='height:" + $(window).height() + "px'><img onclick=\"hiddenSetting('share_mask')\" src='"+imgurl+"' /></div>");
        }



    })
    //提交订单事件
    $("#no").click(function(){
        $("#placeOrder").hide();
    });
    $("#submit_order").click(function(){
       $("#placeOrder").show();
    });
    $("#yes").click(function(){
        var order_id = "<?php echo isset($output['order_info']['bg_order_id'])? $output['order_info']['bg_order_id']:$_GET['order_id']; ?>";
        if(order_id==''){
            alert('参数错误');
            return;
        }
        $.ajax({
            type:'post',
            data:{bargain_id:bargain_id,order_id:order_id},
            url:'index.php?act=bargain_order&op=check_order',
            dataType:'json',
            success:function(result){
                if(result.datas.error){
                   if(result.datas.error.code == '-200'){
                       $(".Popup").empty();
                       var neirong = "<img class='close' src='resource/images/img-17-5.png' /><p class='hotPopup'>"+result.datas.error.msg+"</p><div class='btn'><a class='confirm hpb hpfs' href='#'> 砍价排行</a><a class='confirm hpfs' href='#'> 其他商品</a></div>";
                       $(".Popup").append(neirong);
                       $("#placeOrder").show();
                       $(".close").on('click',function(){

                           $("#placeOrder").hide();
                       })
                   }else{
                       var neirong = " <img class='close' src='resource/images/img-17-5.png' /><p></p><p>"+result.datas.error+"</p><a class='confirm' ><img src='resource/images/img-17-4.png' />OK</a>";
                       $("#placeOrder").hide();
                       pop(neirong,0);
                   }

                }else{
                    if(result.datas.code=='200'){
                        $("#placeOrder").show();
                        $(".Popup").empty();
                        var neirong = "<img class='close' src='resource/images/img-17-5.png' /><p class='hotPopup'>"+result.datas.msg+"</p><div class='btn'><a class='confirm hpb hpfs' id='find_friends' onclick='find_friends()' href='#'> 找好友代付</a><a class='confirm hpfs' href='#' onclick='pay("+order_id+")'> 去买单</a></div>";
                        $(".Popup").append(neirong);
                        $(".close").on('click',function(){
                            $("#placeOrder").hide();
                        })
                    }else{
                        //直接跳转填写地址
                        window.location.href="index.php?act=bargain_order&op=member_address&type=<?php echo $output['bargain_info']['type']; ?>&order_id="+order_id;

                    }

                }

            }

        })
    })

    function hiddenSetting(){
    $("#share_mask").remove();
   }

    function pop(neirong,type){
    $("#Transparent").show();
    $("#Popup").append(neirong);
    $(document).on('click','#Popup>.close,#Popup>.confirm',function(){

        $("#Popup").empty();
        $("#Transparent").hide();
        if(type==1){
            window.location.href = location.href;
        }else if(type==2){
            window.location.href='index.php?act=bargain&op=bargain_info&bargain_id='+bargain_id;
        }

    })

  }
    function pay(order_id){
        window.location.href="index.php?act=bargain_order&op=member_address&type=<?php echo $output['bargain_info']['type']; ?>&order_id="+order_id;
    }

    function addshareCount(){

        $.get('index.php?act=bargain&op=add_share',{bargain_id:bargain_id},function(e){},'json')
    }





    function find_friends()
    {
        var is_weixin = '<?php echo $output['is_weixin'] ?>' ;
        if(is_weixin ==''){
            var obj = {
                appshareurl:'<?php echo 'http://'.$_SERVER['HTTP_HOST'].$_SERVER['REQUEST_URI'].'&order_id='.$output['order_info']['bg_order_id']; ?>',//分享链接
                title:'<?php echo $output['member']['nickname'].'正在参加'.$output['bargain_info']['bg_title'].'快来帮助我吧！'; ?>', // 分享标题
                imgurl:'<?php echo getbargain_img($output['bargain_info']['bg_thumb']); ?>', // 分享图标
                desc: '友帮拼人品，见证奇（友）迹（情）的时刻到了！', // 分享描述
            }
            //不在微信里面，返回分享参数给app
            try{
                window.app.AppShare(JSON.stringify(obj));

            }catch(e){

            }
            try{
                window.webkit.messageHandlers.AppShare.postMessage(JSON.stringify(obj));
            }catch (e){

            }
        }else{
            var imgurl='resource/images/attention.gif';
            $("body").append(
                "<div id='share_mask' onclick='hiddenSetting()' style='height:" + $(window).height() + "px'><img onclick=\"hiddenSetting('share_mask')\" src='"+imgurl+"' /></div>");
        }
    }

</script>
